Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
Source Maps not generated when using Webpack with "webpack serve"

After Webpack compiles the files of my web application into a bundle.js, I need source maps to debug when viewing my application in the browser. The problem is that I cannot seem to generate those Source Maps.

The command I use to launch is

npx webpack serve --config ./webpack.config.js --mode development

The application works fine afterwards except that I cannot debug errors in script.js file when viewing the application in Chrome or Firefox. Instead, the browser console just shows an error in script.js:formatted, which is a one-line file with all my code:

module.exports = " [here is all my code]"

I have the following webpack.config.js file. Note that I include the line devtool: "inline-source-map" (I have also tried devtool: "source-map")`.

//This is my webpack.config.js file
var glob = require("glob");

module.exports = {
  devtool: "inline-source-map",
  entry: {
    app: ['./js/script.js', './style/style.scss', ...glob.sync('./assets/*.png')],
  },
  mode: "development",
  output: {
    filename: './bundle.js',
    path: __dirname,
    sourceMapFilename: "script.js.map"
  },
  devServer: {
    static: './dist',
    hot: true,
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "script-loader"
        }
      },
      {
        test: /\.s[ac]ss$/i,
        use: [
          "style-loader",
          "css-loader",
          "sass-loader",
        ],
      },
      {
        test: /\.(png|svg|jpg|jpeg|gif)$/i,
        type: 'asset/resource',
      },
    ]
  },
};
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda